package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sc.nft.enums.DaoLevelTypeEnum;
import com.sc.nft.enums.IncomeTypeEnum;
import lombok.extern.slf4j.Slf4j;
import com.sc.nft.entity.DaoLevelIncomeDetails;
import com.sc.nft.mapper.DaoLevelIncomeDetailsMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Repository;

/**
 * (sc_dao_level_income_details)数据DAO
 *
 * @author Sun
 * @since 2022-09-21 14:54:49
 * @description 由 Mybatisplus Code Generator 创建
 */
@Slf4j
@Repository
public class DaoLevelIncomeDetailsDao extends ServiceImpl<DaoLevelIncomeDetailsMapper, DaoLevelIncomeDetails> {

    public DaoLevelIncomeDetails getOneByDaoLevelAndType(DaoLevelTypeEnum level, IncomeTypeEnum type) {
        LambdaQueryWrapper<DaoLevelIncomeDetails> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(DaoLevelIncomeDetails::getDaoLevel,level);
        wrapper.eq(DaoLevelIncomeDetails::getIncomeType,type);
        return getOne(wrapper);
    }
}